Q: How many default number methods are available in JavaScript?
Solution: There are a total of 7 default number methods in JavaScript namely: constructor() toExponential() toFixed() toLocaleString() toPrecision() toString() valueOf()
Q: What is the observer effect?
Solution: The observer effect says that simply observing an act influences its outcome. This is often the result of instruments that, by necessity, alter the state of what they measure in some manner.
Q: Which of the following are ways to benchmark code?
Solution: There are a couple of ways to benchmark code—either by timing it or by calculating the number of operations performed during execution. Both of them help in calculating how efficient and modular the code.
Q: How to calculate the run time of a code?
Solution: Run-time statements use the static resources created by compile-time statements, but can also create, use, and destroy dynamic resources at run time. The run time of code can be calculated as: run time = end time – start time
Q: According to the workflow of a runtime logging, what happens after calculating the run time?
Solution: According to the workflow of a runtime logging, after calculating the run time, decision boxes are kept that will check to either display to the debug screen or log to the server.
Q: Which of the following object is used to post the data to an external process, say savePerfData?
Solution: XHR(XMLHttpRequest) is an API in the form of an object whose methods transfer data between a web browser and a web server. The benchmarking process will call the external process. We use XHR object to post the data to the external process.
Q: Where does the external process save the result of the test?
Solution: A flat file consists of a single table of data. It allows the user to specify data attributes, such as columns and data types table by table, and stores those attributes separate from applications. The external process, say savePerfData should in turn save the results of the test in a flat file.
Q: Which function is used to start the time logging?
Solution: The function startTimeLogging() is used to start the time logging. The startTimeLogging() method captures the timing data for ad hoc, etc for referencing an uncached document.location.
Q: Which of the following attribute of form tag is not set by using document object in JavaScript?
Solution: Target, enctype & action can be set by using the document object in JavaScript. The Document object has various properties that refer to other objects which allow access to and modification of document content.
Q: What will be the output of the following JavaScript function?
Solution: The write() method writes HTML expressions or JavaScript code to a document.The write() method is mostly used for testing: If it is used after an HTML document is fully loaded, it will delete all existing HTML. The output for the above code is Sanfoundry The Best.
You Have Score    | /10 |